package cn.tank.data.sync.core;


import cn.tank.data.sync.core.common.Constants;
import cn.tank.data.sync.core.common.Message;

public interface MessageSendService {

    void sendMessage(String channel, Message messge);

    default void write(String channel, Object entiry) {
        sendMessage(channel, new Message(Constants.WRITE, entiry));
    }

    default void update(String channel, Object entiry) {
        sendMessage(channel, new Message(Constants.UPDATE, entiry));
    }

    default void delete(String channel, Object entiry) {
        sendMessage(channel, new Message(Constants.DELETE, entiry));
    }

    default void refresh(String channel) {
        sendMessage(channel, new Message(Constants.REFRESH, null));
    }

}
